const Controllers = require('../controllers/index');
const validate = require('../middlewares/validate');

const routes = [
  {
    // 名片列表
    path: '/api/getCallingCardList',
    method: 'post',
    validate: validate({
      'pageNum': 'required|number',
      'pageSize': 'required|number',
    }),
    controller: Controllers.getCallingCardList
  },
  {
    // 名片列表
    path: '/getCallingCardList',
    method: 'post',
    validate: validate({
      'pageNum': 'required|number',
      'pageSize': 'required|number',
    }),
    controller: Controllers.getCallingCardList
  },
  {
    // 新增名片
    path: '/api/addCallingCard',
    method: 'post',
    validate: validate({
      'name': 'required',
      'phone': 'required',
      'working_years': 'required',
    }),
    controller: Controllers.addCallingCard
  },
  {
    // 更新名片
    path: '/api/updateCallingCard',
    method: 'post',
    validate: validate({
      'name': 'required',
      'phone': 'required',
      'working_years': 'required',
    }),
    controller: Controllers.updateCallingCard
  },
  {
    // 名片详情
    path: '/api/callingCardById',
    method: 'get',
    validate: validate({
      'id': 'required',
    }),
    controller: Controllers.callingCardById
  },
  {
    // 名片详情
    path: '/callingCardById',
    method: 'get',
    validate: validate({
      'id': 'required',
    }),
    controller: Controllers.callingCardById
  },
  {
    // 删除名片
    path: '/api/deleteCallingCardById',
    method: 'get',
    validate: validate({
      'id': 'required',
    }),
    controller: Controllers.deleteCallingCardById
  },
];

module.exports = routes;